/**
 * @param {number[]} nums
 * @return {number}
 */
const lowerBound = (nums, val) => {
	let l = 0,
		r = nums.length
	while (l < r) {
		const m = (l + r) >> 1
		if (nums[m] >= val) {
			r = m
		} else {
			l = m + 1
		}
	}
	return l
}
/* 
    找到第一个>=0的位置和第一个>=1的位置
*/
var maximumCount = function (nums) {
	if (nums[0] > 0) return nums.length
	const pos1 = lowerBound(nums, 0)
	const pos2 = lowerBound(nums, 1)
	return Math.max(pos1, nums.length - pos2)
}
